*****
* Master File for replicating "Do recruiters penalize men who prefer low hours?" by Daniel Kopp
* published in the Journal of Labor Economics
* 
* Accepted for publication on August 28th 2024
* Correspondence: Daniel Kopp, kopp@kof.ethz.ch
*****

// See README for information

*****************************
*****************************
* Setup
*****************************
*****************************

clear all
set more off

* Set paths
global project_path "..\Replication_files"  // set path to main project folder
global raw_data_path 		"data_raw"
global processed_data_path	"data_processed"
global save_path 			"Save_estimates"
global results_part_time 	"results_and_paper"		

* Set project folder as current working directory
cd "$project_path"

* Set ado-file path
sysdir 	set PLUS 	"$project_path\utils"

* Set up programs and dependencies
ssc install	coefplot, replace
ssc install	estout , replace
ssc install	reghdfe, replace			
ssc install	distinct, replace
ssc install	ftools, replace
ssc install	egenmore, replace
ssc install addplot, replace
ssc install appendfile, replace
ssc install	gtools, replace


*****************************
*****************************
* Data preparation and anlysis
*****************************
*****************************

******
* Scripts 1_* prepare the dataset with all ads published on Job-Room (job_ads_from_api) and the dataset with all jobseeker clicks (ad_clicks).
******

* Before running any of the Stata scripts, we need to run the following three R scripts manually:

* 1_1_jobroom_api_info.R				
* 1_2_persnr_date_to_stes_id.R				
* 1_3_import_ad_clicks						
	
	
******
* Scripts 2_* prepare the datasets of registered jobseekers (stes) and ads directly reported to Job-Room (oste)
******

do 2_1_prepare_stes.do

do 2_2_Prepare_oste.do

do 2_3_Prepare_oste_occup.do


******
* Scripts 4_* analyse the click and the job ad data.
******

do 4_1_Stes_click_sample_part_time_preferences_all_ads.do		

do 4_2_Job_ads_analysis_full_part_time_all_ads.do 

do 4_3_Job_ads_analysis_full_part_time_registered_ads.do 

do 4_4_Job_ads_analysis_occup_coverage.do

******
* Scripts 5_* perform the post-double selection with Lasso
******

do 5_0_Dataset_prep_gen_interact.do

do 5_1_preparation_lasso_selection_parttime.do

STOP   // We now need to run the following script in R, which performs the post-double selection with Lasso:

* 5_2_lasso_selection_parttime.R-scripts  


******
* Scripts 6_* perform descriptive analyses of the recruiter click data and the OECD time use data.
******

do 6_0_Creation_human_capital_index_new.do  

do 6_1_Descriptive_Part_Fulltime.do

do 6_2_Descr_stat_discrimination.do

do 7_1_Gen_share_unpaid_oecd.do


******
* Scripts 8_1 performs the regression analysis on the recruiter click data.
******

do 8_1_Regress_Part_Fulltime.do


******
* Scripts 9_* produce figures and tables from the regression analysis of the recruiter click data.
******

do 9_1_Produce_Figures_Part_Fulltime.do

do 9_2_Produce_Figures_Part_Fulltime_byIsco2_MenWomentog.do

do 9_3_Produce_Figures_Part_Fulltime_byIsco2_MenWomenSep.do

do 9_4_Produce_Figures_Part_Fulltime_bycanton.do








